IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

[LVL] Adapter le code de l'exemple de la licence


Sujet :

Android

  1. #1
    Futur Membre du Club
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Points : 7
    Points
    7
    Par défaut [LVL] Adapter le code de l'exemple de la licence
    J'ai eu beau lire, relire le tuto de google sur la licence, j'ai quand même beaucoup de mal.

    En l’occurrence, je ne cherche pas à faire un bouton ou qqchose comme ça pour vérifier la licence, mais plutôt qqchose d'automatique.

    Je vous mets le code mainactivity.jave de la licence en exemple, vous verrez la partie où l'on doit appuyer sur le bouton :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    /*
     * Copyright (C) 2010 The Android Open Source Project
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
     
    package com.example.android.market.licensing;
     
    import com.google.android.vending.licensing.AESObfuscator;
    import com.google.android.vending.licensing.LicenseChecker;
    import com.google.android.vending.licensing.LicenseCheckerCallback;
    import com.google.android.vending.licensing.Policy;
    import com.google.android.vending.licensing.ServerManagedPolicy;
     
    import android.app.Activity;
    import android.app.AlertDialog;
    import android.app.Dialog;
    import android.content.DialogInterface;
    import android.content.Intent;
    import android.net.Uri;
    import android.os.Bundle;
    import android.os.Handler;
    import android.provider.Settings.Secure;
    import android.view.View;
    import android.view.Window;
    import android.widget.Button;
    import android.widget.TextView;
     
    /**
     * Welcome to the world of Android Market licensing. We're so glad to have you
     * onboard!
     * <p>
     * The first thing you need to do is get your hands on your public key.
     * Update the BASE64_PUBLIC_KEY constant below with your encoded public key,
     * which you can find on the
     * <a href="http://market.android.com/publish/editProfile">Edit Profile</a>
     * page of the Market publisher site.
     * <p>
     * Log in with the same account on your Cupcake (1.5) or higher phone or
     * your FroYo (2.2) emulator with the Google add-ons installed. Change the
     * test response on the Edit Profile page, press Save, and see how this
     * application responds when you check your license.
     * <p>
     * After you get this sample running, peruse the
     * <a href="http://developer.android.com/guide/publishing/licensing.html">
     * licensing documentation.</a>
     */
    public class MainActivity extends Activity {
        private static final String BASE64_PUBLIC_KEY = "mettre sa clé ici";
     
        // Generate your own 20 random bytes, and put them here.
        private static final byte[] SALT = new byte[] {
            -46, 65, 30, -128, -103, -57, 74, -64, 51, 88, -95, -45, 77, -117, -36, -113, -11, 32, -64,
            89
        };
     
        private TextView mStatusText;
        private Button mCheckLicenseButton;
     
        private LicenseCheckerCallback mLicenseCheckerCallback;
        private LicenseChecker mChecker;
        // A handler on the UI thread.
        private Handler mHandler;
     
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
            setContentView(R.layout.main);
     
            mStatusText = (TextView) findViewById(R.id.status_text);
            mCheckLicenseButton = (Button) findViewById(R.id.check_license_button);
            mCheckLicenseButton.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
                    doCheck();
                }
            });
     
            mHandler = new Handler();
     
            // Try to use more data here. ANDROID_ID is a single point of attack.
            String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
     
            // Library calls this when it's done.
            mLicenseCheckerCallback = new MyLicenseCheckerCallback();
            // Construct the LicenseChecker with a policy.
            mChecker = new LicenseChecker(
                this, new ServerManagedPolicy(this,
                    new AESObfuscator(SALT, getPackageName(), deviceId)),
                BASE64_PUBLIC_KEY);
            doCheck();
        }
     
        protected Dialog onCreateDialog(int id) {
            final boolean bRetry = id == 1;
            return new AlertDialog.Builder(this)
                .setTitle(R.string.unlicensed_dialog_title)
                .setMessage(bRetry ? R.string.unlicensed_dialog_retry_body : R.string.unlicensed_dialog_body)
                .setPositiveButton(bRetry ? R.string.retry_button : R.string.buy_button, new DialogInterface.OnClickListener() {
                    boolean mRetry = bRetry;
                    public void onClick(DialogInterface dialog, int which) {
                        if ( mRetry ) {
                            doCheck();
                        } else {
                            Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                                    "http://market.android.com/details?id=" + getPackageName()));
                                startActivity(marketIntent);                        
                        }
                    }
                })
                .setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                    }
                }).create();
        }
     
        private void doCheck() {
            mCheckLicenseButton.setEnabled(false);
            setProgressBarIndeterminateVisibility(true);
            mStatusText.setText(R.string.checking_license);
            mChecker.checkAccess(mLicenseCheckerCallback);
        }
     
        private void displayResult(final String result) {
            mHandler.post(new Runnable() {
                public void run() {
                    mStatusText.setText(result);
                    setProgressBarIndeterminateVisibility(false);
                    mCheckLicenseButton.setEnabled(true);
                }
            });
        }
     
        private void displayDialog(final boolean showRetry) {
            mHandler.post(new Runnable() {
                public void run() {
                    setProgressBarIndeterminateVisibility(false);
                    showDialog(showRetry ? 1 : 0);
                    mCheckLicenseButton.setEnabled(true);
                }
            });
        }    
     
        private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
            public void allow(int policyReason) {
                if (isFinishing()) {
                    // Don't update UI if Activity is finishing.
                    return;
                }
                // Should allow user access.
                displayResult(getString(R.string.allow));
            }
     
            public void dontAllow(int policyReason) {
                if (isFinishing()) {
                    // Don't update UI if Activity is finishing.
                    return;
                }
                displayResult(getString(R.string.dont_allow));
                // Should not allow access. In most cases, the app should assume
                // the user has access unless it encounters this. If it does,
                // the app should inform the user of their unlicensed ways
                // and then either shut down the app or limit the user to a
                // restricted set of features.
                // In this example, we show a dialog that takes the user to Market.
                // If the reason for the lack of license is that the service is
                // unavailable or there is another problem, we display a
                // retry button on the dialog and a different message.
                displayDialog(policyReason == Policy.RETRY);
            }
     
            public void applicationError(int errorCode) {
                if (isFinishing()) {
                    // Don't update UI if Activity is finishing.
                    return;
                }
                // This is a polite way of saying the developer made a mistake
                // while setting up or calling the license checker library.
                // Please examine the error code and fix the error.
                String result = String.format(getString(R.string.application_error), errorCode);
                displayResult(result);
            }
        }
     
        @Override
        protected void onDestroy() {
            super.onDestroy();
            mChecker.onDestroy();
        }
     
    }

  2. #2
    Membre éprouvé
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    757
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 757
    Points : 968
    Points
    968
    Par défaut
    Il faut juste remplacer
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    mStatusText = (TextView) findViewById(R.id.status_text);
    mCheckLicenseButton = (Button) findViewById(R.id.check_license_button);
    mCheckLicenseButton.setOnClickListener(new View.OnClickListener() {
       public void onClick(View view) {
           doCheck();
        }
    });
    par
    Ainsi, la vérification se lancera dès le démarrage de l'Activity

  3. #3
    Futur Membre du Club
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Points : 7
    Points
    7
    Par défaut
    Merci beaucoup. Je vire pas ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     mStatusText = (TextView) findViewById(R.id.status_text);
            mCheckLicenseButton = (Button) findViewById(R.id.check_license_button);
            mCheckLicenseButton.setOnClickListener(new View.OnClickListener() {
    Et si j'ai déjà publié l'app, je peux faire une maj avec la licence inclue ?

    Edit : J'ai une erreur sur l'AVD :

    05-18 07:12:56.352: E/AndroidRuntime(747): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fr/com.example.fr.FbdActivity}: java.lang.NullPointerException


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    public class FbdActivity extends Activity  {
        /** Called when the activity is first created. */
     
    	private static final String BASE64_PUBLIC_KEY = "clé";
    	//Licence play
        // Generate your own 20 random bytes, and put them here.
        private static final byte[] SALT = new byte[] {
            20 chiffres aléatoires
        };
     
        private TextView mStatusText;
        private Button mCheckLicenseButton;
     
        private LicenseCheckerCallback mLicenseCheckerCallback;
        private LicenseChecker mChecker;
        // A handler on the UI thread.
        private Handler mHandler;
     
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
            setContentView(R.layout.main);
     
                    doCheck();
     
     
     
            mHandler = new Handler();
     
            // Try to use more data here. ANDROID_ID is a single point of attack.
            String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
     
            // Library calls this when it's done.
            mLicenseCheckerCallback = new MyLicenseCheckerCallback(); 
     
     
            // Construct the LicenseChecker with a Policy.
            mChecker = new LicenseChecker(
                this, new ServerManagedPolicy(this,
                    new AESObfuscator(SALT, getPackageName(), deviceId)),
                BASE64_PUBLIC_KEY  // Your public licensing key.
                );
            doCheck();
        } 
     
         protected Dialog onCreateDialog(int id) {
             final boolean bRetry = id == 1;
             return new AlertDialog.Builder(this)
                 .setTitle(R.string.unlicensed_dialog_title)
                 .setMessage(bRetry ? R.string.unlicensed_dialog_retry_body : R.string.unlicensed_dialog_body)
                 .setPositiveButton(bRetry ? R.string.retry_button : R.string.buy_button, new DialogInterface.OnClickListener() {
                     boolean mRetry = bRetry;
                     public void onClick(DialogInterface dialog, int which) {
                         if ( mRetry ) {
                             doCheck();
                         } else {
                             Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                                     "http://market.android.com/details?id=" + getPackageName()));
                                 startActivity(marketIntent);                        
                         }
                     }
                 })
                 .setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
                     public void onClick(DialogInterface dialog, int which) {
                         finish();
                     }
                 }).create();
         }
     
         private void doCheck() {
             mCheckLicenseButton.setEnabled(false);
             setProgressBarIndeterminateVisibility(true);
             mStatusText.setText(R.string.checking_license);
             mChecker.checkAccess(mLicenseCheckerCallback);
         }
     
         private void displayResult(final String result) {
             mHandler.post(new Runnable() {
                 public void run() {
                     mStatusText.setText(result);
                     setProgressBarIndeterminateVisibility(false);
                     mCheckLicenseButton.setEnabled(true);
                 }
             });
         }
     
         private void displayDialog(final boolean showRetry) {
             mHandler.post(new Runnable() {
                 public void run() {
                     setProgressBarIndeterminateVisibility(false);
                     showDialog(showRetry ? 1 : 0);
                     mCheckLicenseButton.setEnabled(true);
                 }
             });
         }    
     
         private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
             public void allow(int policyReason) {
                 if (isFinishing()) {
                     // Don't update UI if Activity is finishing.
                     return;
                 }
                 // Should allow user access.
                 displayResult(getString(R.string.allow));
             }
     
             public void dontAllow(int policyReason) {
                 if (isFinishing()) {
                     // Don't update UI if Activity is finishing.
                     return;
                 }
                 displayResult(getString(R.string.dont_allow));
                 // Should not allow access. In most cases, the app should assume
                 // the user has access unless it encounters this. If it does,
                 // the app should inform the user of their unlicensed ways
                 // and then either shut down the app or limit the user to a
                 // restricted set of features.
                 // In this example, we show a dialog that takes the user to Market.
                 // If the reason for the lack of license is that the service is
                 // unavailable or there is another problem, we display a
                 // retry button on the dialog and a different message.
                 displayDialog(policyReason == Policy.RETRY);
             }
     
             public void applicationError(int errorCode) {
                 if (isFinishing()) {
                     // Don't update UI if Activity is finishing.
                     return;
                 }
                 // This is a polite way of saying the developer made a mistake
                 // while setting up or calling the license checker library.
                 // Please examine the error code and fix the error.
                 String result = String.format(getString(R.string.application_error), errorCode);
                 displayResult(result);
             }
         }
     
         @Override
         protected void onDestroy() {
             super.onDestroy();
             mChecker.onDestroy();
         }


    Merci encore.

  4. #4
    Membre éprouvé
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    757
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 757
    Points : 968
    Points
    968
    Par défaut
    Au temps pour moi, j'ai fais une petite erreur.
    Voici le contenu de la méthode onCreate :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
            setContentView(R.layout.main);
            mHandler = new Handler();
     
            // Try to use more data here. ANDROID_ID is a single point of attack.
            String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
     
            // Library calls this when it's done.
            mLicenseCheckerCallback = new MyLicenseCheckerCallback(); 
     
     
            // Construct the LicenseChecker with a Policy.
            mChecker = new LicenseChecker(
                this, new ServerManagedPolicy(this,
                    new AESObfuscator(SALT, getPackageName(), deviceId)),
                BASE64_PUBLIC_KEY  // Your public licensing key.
                );
     
            doCheck();
        }
    Pour ce qui est de la mise à jour de l'application, ça ne pose aucun problème (il me semble).
    N'oublie pas d'incrémenter le numéro de version dans le Manifest.xml

  5. #5
    Futur Membre du Club
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Points : 7
    Points
    7
    Par défaut
    Bonjour, désolé j'ai toujours la même erreur

    J'ai enlevé : mStatusText = (TextView) findViewById(R.id.status_text);

    Car je n'ai pas de layout avec un id de texte, faut-il que j'ajoute un textview à mon layout principal ? ?

  6. #6
    Membre éprouvé
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    757
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 757
    Points : 968
    Points
    968
    Par défaut
    Tout dépend à quoi ressemble ton layout.
    Pourrais-tu nous montrer ton fichier main.xml ?
    Ainsi que la stackTrace complète de l'erreur que tu obtiens (Type d'erreur, n° de ligne etc)

  7. #7
    Futur Membre du Club
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Points : 7
    Points
    7
    Par défaut
    Désolé pour le délai de réponse.

    J'ai un main.xml basique avec des linearlayouts et qqs boutons, c'est tout. Par contre il n'y a rien sur un éventuel textview, c'est sur.

    POur le code d'erreurs, j'ai mis à debug sur logcat et j'ai ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    05-23 13:46:37.735: D/dalvikvm(17914): GC_EXTERNAL_ALLOC freed 46K, 49% free 2747K/5379K, external 0K/0K, paused 35ms
    05-23 13:46:38.180: D/AndroidRuntime(17914): Shutting down VM
    05-23 13:46:38.180: W/dalvikvm(17914): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
    05-23 13:46:38.185: E/AndroidRuntime(17914): FATAL EXCEPTION: main
    05-23 13:46:38.185: E/AndroidRuntime(17914): java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.mon.appli/fr.mon.appli.FbdActivity}: java.lang.NullPointerException
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.os.Handler.dispatchMessage(Handler.java:99)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.os.Looper.loop(Looper.java:130)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.app.ActivityThread.main(ActivityThread.java:3691)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at java.lang.reflect.Method.invokeNative(Native Method)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at java.lang.reflect.Method.invoke(Method.java:507)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at dalvik.system.NativeStart.main(Native Method)
    05-23 13:46:38.185: E/AndroidRuntime(17914): Caused by: java.lang.NullPointerException
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at fr.mon.appli.FbdActivity.doCheck(FbdActivity.java:97)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at fr.mon.appli.FbdActivity.onCreate(FbdActivity.java:70)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
    05-23 13:46:38.185: E/AndroidRuntime(17914): 	... 11 more

  8. #8
    Membre éprouvé
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    757
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 757
    Points : 968
    Points
    968
    Par défaut
    Comme il l'est écrit : Il y a un objet null à la ligne 97

    at fr.mon.appli.FbdActivity.doCheck(FbdActivity.java:97)

  9. #9
    Futur Membre du Club
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Points : 7
    Points
    7
    Par défaut
    De 96 à 101, j'ai ça

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    private void doCheck() {
            mCheckLicenseButton.setEnabled(false);
            setProgressBarIndeterminateVisibility(true);
            mStatusText.setText(R.string.checking_license);
            mChecker.checkAccess(mLicenseCheckerCallback);
        }
    La ligne 70 c'est doCheck();
    Merci encore de m'aider

  10. #10
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2012
    Messages
    149
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Janvier 2012
    Messages : 149
    Points : 109
    Points
    109
    Par défaut
    l’erreur vient de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    mCheckLicenseButton.setEnabled(false);
    soit tu n'as pas de bouton dans ton xml soit tu ne l'as pas initialisé

  11. #11
    Futur Membre du Club
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Points : 7
    Points
    7
    Par défaut


    Rhaaaa, j'avais pas bien lu la ligne

    Et bien oui, je n'ai pas de bouton, mais je n'en veux pas non plus.... (cf plus haut...)

  12. #12
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2012
    Messages
    149
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Janvier 2012
    Messages : 149
    Points : 109
    Points
    109
    Par défaut
    vu que tu t'en sers plus autan le virer tu enlèves toute les lignes qui lui font référence

  13. #13
    Futur Membre du Club
    Inscrit en
    Mai 2012
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 13
    Points : 7
    Points
    7
    Par défaut
    En fait je souhaiterais un check automatique au lancement de l'application, si ça ne passe pas alors on affiche les boutons (cf le code complet de l'example au dessus)

    Du coup il reste ces lignes sur les boutons retry :

    .setPositiveButton(bRetry ? R.string.retry_button : R.string.buy_button, new DialogInterface.OnClickListener() {

    J'ai viré le bouton checklicence

    et j'ai une erreur ici :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    private void doCheck() {
    //        mCheckLicenseButton.setEnabled(false);
            setProgressBarIndeterminateVisibility(true);
            mStatusText.setText(R.string.checking_license);
            mChecker.checkAccess(mLicenseCheckerCallback);
        }
    à la dernière ligne

  14. #14
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2012
    Messages
    149
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Janvier 2012
    Messages : 149
    Points : 109
    Points
    109
    Par défaut
    c'est quoi ton erreur mais le logcat s'il te plait

Discussions similaires

  1. [Oracle] [PL/SQL] Adapter un code VB
    Par LoulouFifi dans le forum Oracle
    Réponses: 1
    Dernier message: 20/07/2006, 16h11
  2. Réponses: 7
    Dernier message: 24/03/2006, 09h25
  3. [débutant] Pb adaptation de code VBA
    Par delphineleclerc1 dans le forum Access
    Réponses: 9
    Dernier message: 28/02/2006, 12h58
  4. Réponses: 22
    Dernier message: 06/10/2005, 10h53
  5. [VBA Excel Word]Adapter un code Excel a Word
    Par Baxter67 dans le forum VBA Word
    Réponses: 4
    Dernier message: 08/08/2005, 23h43

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo