Posts

Showing posts with the label android

How to exclude Firebase Messaging from Unity iOS builds, but not Android builds

Image
Clash Royale CLAN TAG #URR8PPP How to exclude Firebase Messaging from Unity iOS builds, but not Android builds I have a Unity project that builds for both Android and iOS. I want to integrate Firebase on my Android builds, but not for my iOS builds. Is there a way to exclude Firebase Messaging from the iOS builds completely, but keep it in for Android? I don't see the options to do so in the Firebase settings panel. I tried to unselect the Editor/iOS parts of the unity package when installing it, but I still get linker errors (when building my iOS app in Xcode) that reference missing Firebase directories. Thanks in advance, - cg By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

sending a keyword to bring the location

Image
Clash Royale CLAN TAG #URR8PPP sending a keyword to bring the location hello every one **i want to send a keyword in a message that bring me the location of the reciever when the message will send i don t know how to add this option in my code ** i have my own map that i created with fragment that gives you your position this is my main activity import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class Main3Activity extends AppCompatActivity { private static final String TAG = Main3Activity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main3); } /** * Uses an implicit intent to dial the phone with the Phone app. * Gets the phone number...

Bluetooth audio controls in Android

Image
Clash Royale CLAN TAG #URR8PPP Bluetooth audio controls in Android My app streams music and I want to be able to pause/play/skip from any Bluetooth device that might support these buttons (car, headset, etc). When connected through a car's bluetooth the audio comes through automatically, but the control buttons do not affect my app's audio stream. It instead opens the default media player. How do I route these buttons to affect my app? Hi, Can you share example code for this same ? – Hardik Joshi May 9 '14 at 7:12 3 Answers 3 Have you registered a BroadcastReceiver in your app to listen to MEDIA_BUTTON events using AudioManager.registerMediaButtonEventReceiver() ? BroadcastReceiver MEDIA_BUTTON AudioManager.registerMediaButtonEventReceiver(...

Android take picture, but save a small size 160x160 image in internal memory

Image
Clash Royale CLAN TAG #URR8PPP Android take picture, but save a small size 160x160 image in internal memory I have looked around but I could not find a suitable answer, hence asking it here. I want to take a picture, and save a lower size version eg. 160x160 size in phone's internal memory. Now, I have seen code saving full size picture in internal and external memory. I have seen code getting a bitmap thumbnail from the picture, but this exact scenario is not explored in depth anywhere. I do not want any copy of this picture to exist except a 160 x 160 size (whichever height/width limit applies) in internal memory. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

error while generating signed apk init

Image
Clash Royale CLAN TAG #URR8PPP error while generating signed apk init Hey i am trying to generate signed apk to upload to the store and i keep getting this error: Error:FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':android:lintVitalRelease'. Could not resolve all files for configuration ':android:lintClassPath'. Could not resolve com.android.tools.external.com-intellij:intellij-core:26.1.0. Required by: project :android > com.android.tools.lint:lint-gradle:26.1.0 project :android > com.android.tools.lint:lint-gradle:26.1.0 > com.android.tools.lint:lint:26.1.0 > com.android.tools.lint:lint-checks:26.1.0 project :android > com.android.tools.lint:lint-gradle:26.1.0 > com.android.tools.lint:lint:26.1.0 > com.android.tools.lint:lint-kotlin:26.1.0 project :android > com.android.tools.lint:lint-gradle:26.1.0 > com.android.tools.lint:lint:26.1.0 > com.android.tools.lint:lint-c...

How to open Firefox about:reader?url=example.com with Intent on Android

Image
Clash Royale CLAN TAG #URR8PPP How to open Firefox about:reader?url=example.com with Intent on Android I'm a trying to open a webpage on an android application, the url sheme is a bit special it has to open an url in reader mode : about:reader?url=example.com about:reader?url=example.com I am doing it this way Uri intentUri = new Uri.Builder().encodedPath("about:reader") .appendQueryParameter("url", Uri.encode("example.com")) .build(); // Try to open in Firefox If available or use default Intent intent=new Intent(Intent.ACTION_VIEW); intent.setData(intentUri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setPackage("org.mozilla.firefox"); try { getApplicationContext().startActivity(intent); } catch (ActivityNotFoundException ex) { intent.setPackage(null); getApplicationContext().startActivity(intent); } And i get E/AndroidRuntime: FATAL EXCEPTION: main Caused by: android.content.ActivityNotFoundException: No Acti...

What does it mean that Kotlin based apps will get a performance boost on Android P

Image
Clash Royale CLAN TAG #URR8PPP What does it mean that Kotlin based apps will get a performance boost on Android P Over the last few of months in a bunch of places I've seen the information that Android P will give the performance boost to Kotlin based apps (e.g. here and here). On the official Android blog, Dave Burke in "Previewing Android P" post described it in a few words: Kotlin is a first-class language on Android, and if you haven't tried it yet, you should! We've made an enduring commitment to Kotlin in Android and continue to expand support including optimizing the performance of Kotlin code. In P you'll see the first results of this work -- we've improved several compiler optimizations, especially those that target loops, to extract better performance. We're also continuing to work in partnership with JetBrains to optimize Kotlin's generated code. You can get all of the latest Kotlin performance improvements just by keeping Android Studio...

My app crashes on google sign-in

Image
Clash Royale CLAN TAG #URR8PPP My app crashes on google sign-in I am integrating google sign-in into my android project using Firebase. Following this tutorial, I was able to get the login. But when I choose the account, the app crashes. By the way I am using Kotlin language. The code snippet is as follows: class SignupActivity:AppCompatActivity(){ lateinit var googleSignInClient: GoogleSignInClient lateinit var gso: GoogleSignInOptions val RC_SIGN_IN :Int =1 lateinit var signOut:Button lateinit var mAuth: FirebaseAuth private var callbackManager: CallbackManager?=null @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.signup) header_signup_button.setOnClickListener { startActivity(Intent(this,SplashscreenActivity::class.java)) } gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.defa...

ConnectivityManager error logs

Image
Clash Royale CLAN TAG #URR8PPP ConnectivityManager error logs 11-27 10:30:33.686 31795 31795 D ConnectivityManager: getMobileDataEnabled()+ subId=1 11-27 10:30:33.688 31795 31795 D ConnectivityManager: getMobileDataEnabled()- subId=1 retVal=true 11-27 10:30:36.231 31795 31795 D ConnectivityManager: getMobileDataEnabled()+ subId=1 11-27 10:30:36.235 31795 31795 D ConnectivityManager: getMobileDataEnabled()- subId=1 retVal=true 11-27 10:30:43.929 31795 31795 D ConnectivityManager: getMobileDataEnabled()+ subId=1 11-27 10:30:43.931 31795 31795 D ConnectivityManager: getMobileDataEnabled()- subId=1 retVal=true 11-27 10:30:49.046 31795 31795 D ConnectivityManager: getMobileDataEnabled()+ subId=1 11-27 10:30:49.048 31795 31795 D ConnectivityManager: getMobileDataEnabled()- subId=1 retVal=true 11-27 10:30:51.608 31795 31795 D ConnectivityManager: getMobileDataEnabled()+ subId=1 11-27 10:30:51.611 31795 31795 D ConnectivityManager: getMobileDataEnabled()- subId=1 retVal=true 11-27 10:30:54.170...

Animate TextView to increase integer and stop at some point?

Image
Clash Royale CLAN TAG #URR8PPP Animate TextView to increase integer and stop at some point? I have a TextView showing integer value. Integer value is transferred from previous activity, and I want to add nice animation. I want to if for example int value is 73, I want textView to increase shown number by 1 until 73, so it would be 1-2-3-4-5...etc etc. How can I do this? are you aware of this: developer.android.com/reference/android/widget/… – pskink Oct 22 '14 at 8:09 you want animation why?? i mean you can simply use for loop and set the value in textview..and use thread or timer to upadte the text view on particular interval of time – Meenal Oct 22 '14 at 8:16 ...

Android Spinner to determine Marker Colour

Image
Clash Royale CLAN TAG #URR8PPP Android Spinner to determine Marker Colour I have a spinner which I have created for a project in Android studio. The spinner takes the following values from an array in my strings.xml file. <string-array name="activity_types"> <item>Games</item> <item>Learn</item> <item>Fitness</item> <item>Make</item> <item>Explore</item> <item>Find</item> </string-array> I would like to create a function which places a marker of a particular colour onto my map in MainActivity i.e. selecting Games, will place an orange marker on the map, when 'Games' is selected and the 'Place' button (below) is pressed. However, I am not sure how to go about this? place_btn = (Button) findViewById(R.id.place_btn); place_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //what would handle the...

Why is rxJava not showing any effect of BackPressure startegy?

Image
Clash Royale CLAN TAG #URR8PPP Why is rxJava not showing any effect of BackPressure startegy? Hi I am quite naive with rxJava, so please let me know if my understanding is correct. As per my understanding if I use backpressure strategy with LATEST flag, I should be getting the most recent value. So I have a list, I am using flowable with subscriber, but it is still printing all values in onNext . Also please let me know how to test this backpressure strategy as I do not have real time data. Following is my code Observable.just(listObj).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()). flatMap(new Function<List<String>, Observable<String>>() { @Override public Observable<String> apply(List<String> ints) { return Observable.fromIterable(ints); } }).toFlowable(BackpressureStrategy.LATEST).subscribe(new Su...

ImageView don't load second image

Image
Clash Royale CLAN TAG #URR8PPP ImageView don't load second image I try to dynamically add and remove xml view. When add one view it works fine, but when add another view ImageView don't load image and button doesn't work. LinearLayout.LayoutParams vp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); vp.gravity= Gravity.CENTER; LayoutInflater ltInflater = getLayoutInflater(); View view = ltInflater.inflate(R.layout.publication_image, linearLayout, true); ImageView iv = view.findViewById(R.id.publicationImageView); ImageButton deleteButton = view.findViewById(R.id.deleteButton); deleteButton.setOnClickListener(deleteClickListener); iv.setImageURI(fileUri); listView.add(view); listDeletButton.add(deleteButton); EditText editText = new EditText(this); editText.setLayoutParams(vp); editText.setHint("Введите текст"); editText.setTextSize(15)...

Android get phone number from contact list

Image
Clash Royale CLAN TAG #URR8PPP Android get phone number from contact list I have these codes which basically use a ListView to display the names in the contact list and I want to get their phone number when click each single name: final ContentResolver cr = getContentResolver(); final Cursor c = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); myCursorAdapter = new SimpleCursorAdapter(this, R.layout.list_item, c, new String {ContactsContract.Contacts.DISPLAY_NAME}, new int{R.id.TVRow}, 0); myPhoneList.setAdapter(myCursorAdapter); myPhoneList.setOnItemClickListener(new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id){ c.moveToPosition(position); Toast.makeText(getApplicationContext(), c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)), Toast.LENGTH_SHORT).show(); } }); In the onItemClick Method the onItemClick GetColumnInde...

Admob-lite vs full version: MobileAdsSettingManagerCreatorImpl

Image
Clash Royale CLAN TAG #URR8PPP Admob-lite vs full version: MobileAdsSettingManagerCreatorImpl My app uses play-services-ads-15.0.1 dependency, which in turn depends on play-services-ads-lite play-services-ads-15.0.1 play-services-ads-lite But when the app runs on an emulator, there is an error message: E/Ads: This app is using a lightweight version of the Google Mobile Ads SDK that requires the latest Google Play services to be installed, but Google Play services is either missing or out of date. and no Admob test-ads load. This warning shows in logcat: W/Ads: Could not get remote MobileAdsSettingManager. com.google.android.gms.dynamic.RemoteCreator$RemoteCreatorException: Could not load creator class. at com.google.android.gms.dynamic.RemoteCreator.getRemoteCreatorInstance(Unknown Source:51) at com.google.android.gms.internal.ads.zzme.zzg(Unknown Source:5) at com.google.android.gms.internal.ads.zzjw.zzib(Unknown Source:8) at com.google.android.gms.internal.ads.zzj...

Get center visible item of RecycleView when scrolling

Image
Clash Royale CLAN TAG #URR8PPP Get center visible item of RecycleView when scrolling This is what I want: As image above, I want to draw a center line on RecycleView , then get the center item when scrolling (as well as move left or right) Here is my try to draw a horizontal RecycleView : RecycleView RecycleView HorizontalAdapter adapter = new HorizontalAdapter(data); LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); recycleView.setLayoutManager(layoutManager); recycleView.setAdapter(adapter); Is there any way to know which item is moved to center of RecycleView ? And how can I scroll RecycleView to left or right just one position? RecycleView RecycleView Update : I tried to use a scroll listener to get middle position, but it doesn't work as aspect. @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); ...