Android Trucaller SDK needs a argument in getProfile - android

TruecallerSDK.getInstance().getUserProfile();
The above line is not working in Android Studio. Its the exact line copied from the Truecaller official docs. They that getUserProfile does not take any argument but when i write it like this, it doesn't work.
Please help! It requires a FragmentActivity or a Fragment method.
And i am writing this code in my onCreate in MainActivity

Related

ViewModelProviders.of(getActivity()) "Cannot resolve method of(android.app.Activity)"

I'm currently trying to share data between my two fragments with the help of a view model Android ViewModels.
In the this article they use "ViewModelProviders.of(getActivity()).get(SharedViewModel.class);" in the Fragment to get the model.
My Problem is, that when I write the exact same line into my fragment, I get a "Cannot resolve method of(android.app.Activity)" error
model = ViewModelProviders.of(getActivity()).get(UserAccountViewModel.class);
Can some one help me with this ?
ViewModelProviders requires that you use FragmentActivity (or something derived from it), not Activity, as the base class of your activities.
You might also get a similiar error like Cannot resolve method 'of(android.support.v4.app.FragmentActivity)' from ViewModelProviders.of(getActivity()) if you were trying to import androidx in your gradle file when your app is still using android.support.v4
This is different to the question being asked but is in the same ballpark and ranks first in Google when I had the problem, so I'm posting it!
Just cast getActivity() to specific activity. It works for me. For example:
model = ViewModelProviders.of((MainActivity)getActivity()).get(UserAccountViewModel.class);

Applovin how to initialize sdk in Android

I am trying to initialize the applovin sdk for my react-native app per these instructions: https://developers.google.com/admob/android/mediation/applovin#step_3_import_the_applovin_sdk_and_adapter
On step 3, I am not sure how exactly to use the code AppLovinSdk.initializeSdk(context);. I put it in my MainActivity.java onCreate method, but I get a cannot find symbol error since AppLovinSdk is not defined. What exactly am I missing?
You need this at the top of your Java file
import com.applovin.sdk.AppLovinSdk;
By the way, there's example code here
But, you really should be using an Application class's onCreate rather than an Activity.

Has MvxCachingFragmentCompatActivity disappeared?

I'm trying to upgrade to MvvmCross 5.2 and get a syntax error on the MvxCachingFragmentCompatActivity. Has this class disappeared?
As explained in the blog for 5.2: https://www.mvvmcross.com/mvvmcross-52-release/
We've refactored the Android presenter and there is no need anymore for a special Activity like MvxCachingFragmentCompatActivity. The adviced Activity to use now is the MvxAppCompatActivity.

I can't add admob code interstitial android

hi guys sorry about my english,
I have problem in my application Android , I have code panner in apps it's working! but I don't have code interstitial in application, I tried to enter this code
https://developers.google.com/mobile-ads-sdk/docs/admob/advanced
*add under public class MainActivity extends AbstractContentActivity{
find this problem in eclipse :
Multiple markers at this line
- Cannot override the final method from AbstractActivity
- overrides
com.ex.activity.AbstractActivity.onCreate
If you have control over AbstractActivity, remove the final keyword from onCreate and then you'll be able to extend it properly. Also note that in their example they're using just a plain Activity.
If you can't modify AbstractActivity, look at it's code it must have an extension point (overridable method) which will be called from onCreate.

SelectionFragment class missing - Android based Facebook development

I've created a project where I want to have a list of friends returned. I'm following this tutorial and at section 2c I have realized that my build does not contain a SelectionFragment class. Where online could I download this class, or does anyone have the code for this class? Thank you.
maybe here SelectionFragment.java on github
My guess this class needed to be created a little bit earlier in tutorial.
Choose "Step 1b" link in right column of a page.
https://developers.facebook.com/docs/android/scrumptious/authenticate#step1b
It says like:"Create a new fragment class in your package for the authenticated UI. Name this class ''SelectionFragment'' and make its superclass Fragment."

Categories

Resources