In app purchase for removing Admob in Android(在 Android 中移除 Admob 的应用内购买)
本文介绍了在 Android 中移除 Admob 的应用内购买的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have implemented the code for admob activated , I want to introduce in-app purchase for remove admob , can anybody tell me how can I do this perfectly, I have checked many tutorial but not clear the concept , please help me in this regard.
private ImageView imview;
private int w,h;
private Bitmap filtaringImage = null;
private Bitmap Changebitmap=null;
private Context context;
private LinearLayout linear;
private LinearLayout mainLayout;
private ProgressDialog effectProgress;
private ImageButton normal,r_nd_g,g_nd_b,hsv,hls;
private ContentResolver mContentResolver;
private int IMAGE_MAX_SIZE = 1024;
private List<Bitmap> history;
private List<Bitmap> redo;
//private File temp File = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"./."+UtilsPixolish.TEMP_FILE_NAME);
private boolean showBackAllart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//***************************************
context = this;
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().addTestDevice("unit id ").build();
adView.loadAd(adRequest);
//createTempFolder();
//***************************************
mainLayout = (LinearLayout) findViewById(R.id.mainLayout);
linear = (LinearLayout) findViewById(R.id.sub_liner_scroll);
normal = (ImageButton) findViewById(R.id.normal);
r_nd_g = (ImageButton) findViewById(R.id.r_g);
g_nd_b = (ImageButton) findViewById(R.id.g_b);
hsv = (ImageButton) findViewById(R.id.hsv);
hls = (ImageButton) findViewById(R.id.hls);
imview=(ImageView)findViewById(R.id.imageView1);
showBackAllart = false;
//******** original bitmap *********//
// original = ((BitmapDrawable)imview.getDrawable()).getBitmap();
history = new ArrayList<Bitmap>();
redo = new ArrayList<Bitmap>();
Log.i("Tik", String.valueOf(history.size()));
//history.add(original);
// filtaringImage = ((BitmapDrawable)imview.getDrawable()).getBitmap();
// Changebitmap=((BitmapDrawable)imview.getDrawable()).getBitmap();
imview.setOnLongClickListener(this);
mContentResolver = getContentResolver();
applyNewEffect();
}
in my activity.xml file i have added this for admob
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/admob_id"/>
解决方案
ok, I am going to implement the same thing and planning it as @reverse has told but wanted to confirm how other developers are thinking. However, his answer is complete in itself, I am just giving the steps:
- You already have AdMob implemented.
- Go to playstore developer account and in your app, Add an in-app purchase item. let's say: "No Ads", name doesn't matter here, an ID would matter.
- Use the IAB helper file provided by google and follow the steps how to use it. Refer to this link: http://developer.android.com/training/in-app-billing/preparing-iab-app.html
- Provide a link to pay for "No ads" in-app element by the user.
- On application startup check, by using the above class check whether user has already paid/purchased the in-app element, mark the flag to true. For consistency and unrepeated check, keep this variable in shared preference as null.
- Null means, You have to check with google play for purchase by the user.
- If purchased, mark it true else false.
- if this flag is true: do not show ads.
这篇关于在 Android 中移除 Admob 的应用内购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:在 Android 中移除 Admob 的应用内购买
基础教程推荐
猜你喜欢
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01