کلیدستان

نسخه‌ی کامل: ذخیره کردن حالت اصلی در برنامه
شما در حال مشاهده نسخه آرشیو هستید. برای مشاهده نسخه کامل کلیک کنید.
سلام 
من نمی دونم باید چه کدی بنویسم که وقتی کاربر برنامه رو ارتقا داد و بعد از برنامه خارج شد در حالت اصلی بمونه
این کد های پرداخت من 
کد پی‌اچ‌پی:
package ir.GiyaHan.giyahan;

import android.content.Context;

import android.util.Log;
import utils.IabHelper;
import utils.IabResult;
import utils.Inventory;

public class 
HelperIAP  {
    public static 
IabHelper iabHelper;
    
     public static final  
String RSA "MIHNMA0GCSqGSIb3DQEBAQUAA4G7ADCBtwKBrwC6qeSNbQW3h0SLI3+NlSKjTSrLd7cV+6gkgjy7CZFgdR+qN71UqAO0oZex1wlqxXcqFF/Awtq9l2OHa1VsOY9BbwnHHQwhEW2BZA/D+pjP9IV1iuNRIf3dUuphkZALkjOtfr+PznZW+LzIJQ/68aTkU8BIJ8P4/ITyWiIHepDBj6oXHcy+O7+BfolPtfO8uoHPOAhZLutu6kg0EWJoyNw094pxdltRaMp3GP/6iZ0CAwEAAQ==";
     
     
Context c;
     
     public static final 
String TAG "LOG";
     public static 
boolean helperIAPIsSetup;
     
     
    public static 
void iapInitalizer(Context c ){
        
        if (
iabHelper == null) {
        
         
        
        try{
        
iabHelper = new IabHelper(cRSA);
        
        
iabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
             public 
void onIabSetupFinished(IabResult result) {
            
                 
                 
                 
Log.d(TAG"Setup finished.");
                 

                 if (!
result.isSuccess()) {
                     
Log.d(TAG"Problem setting up In-app Billing: " result);
                 }else{
                     
helperIAPIsSetup true;
                    
                 }
             }
         });
         
        }catch(
Exception exception){
            
exception.printStackTrace();
            
        }
           }
           
    }
    
    public static 
void isUserPermium (final Context c , final IabHelper.QueryInventoryFinishedListener oQIF ){
        
        new 
Thread(new Runnable() {
            
            @
Override
            
public void run() {
                
boolean listenerCall false;
                do {
                    if (
iabHelper == null) {
                        
Log.i("Log"" == null");
                        
iapInitalizer(c);
                        
                    }
                    if (
iabHelper != null && helperIAPIsSetup ){
                        
                        
Log.i("Log""helperIAPIsSetup");
                        if (
oQIF != null){
                        
MainActivity.handler.post(new Runnable() {
                            
                            @
Override
                            
public void run() {
                                
iabHelper.queryInventoryAsync(oQIF);
                            }
                        });
                        
listenerCall true;
                        }
                }
                
            try{
                
Thread.sleep(500);
            }
            catch (
InterruptedException e){
                
e.printStackTrace();
            }
         }
                while (
helperIAPIsSetup && !listenerCall);
       }
    
    }).
start();
  }
    
    
    

و این هم کد های اسپلشم
کد پی‌اچ‌پی:
package ir.GiyaHan.giyahan;

import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;
import android.view.animation.*;
import android.widget.*;

public class 
Splash extends Activity {

    @
Override
    
protected void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState);
        
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        
setContentView(R.layout.activity_splash);
        
Animation in AnimationUtils.loadAnimation(getBaseContext(), android.R.anim.fade_in);
        
Animation sin AnimationUtils.loadAnimation(getBaseContext(), android.R.anim.slide_in_left);
        
        
in.setDuration(500);
        
sin.setDuration(500);
        
in.setStartOffset(500);
        
sin.setStartOffset(1000);
        
        
ImageView img_logo = (ImageViewfindViewById(R.id.splash_logo);
        
img_logo.startAnimation(in);
        
        
        
TextView txt_site = (TextViewfindViewById(R.id.splash_site); 
        
txt_site.startAnimation(sin);
        
        
Handler handler = new Handler();
        
handler.postDelayed(new Runnable() {
            
            @
Override
            
public void run() {

                
finish();
                
Intent next = new Intent(getBaseContext(), MainActivity.class );
                
startActivity(next);
            }
        }, 
3000);
        
        
        
    }