Guest User

Untitled

a guest
Nov 18th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. 11-18 22:32:51.560 3388-3388/? E/HwLauncher: Launcher dialog dismiss failed : java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
  2. 11-18 22:32:51.810 2862-2879/? E/BroadcastQueue: processNextBroadcast log test
  3. 11-18 22:32:51.820 2862-3190/? E/BroadcastQueue: processNextBroadcast log test
  4. 11-18 22:32:51.820 2862-3386/? E/BroadcastQueue: processNextBroadcast log test
  5.  
  6. apply plugin: 'com.android.application'
  7.  
  8. android {
  9. compileSdkVersion 26
  10. buildToolsVersion "26.0.1"
  11.  
  12. defaultConfig {
  13. applicationId "...."
  14. minSdkVersion 16
  15. targetSdkVersion 22
  16. versionCode 1
  17. versionName "1.0"
  18. multiDexEnabled true
  19.  
  20. }
  21. buildTypes {
  22. release {
  23. minifyEnabled false
  24. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  25. }
  26. }
  27.  
  28. packagingOptions {
  29. exclude 'META-INF/LICENSE'
  30. exclude 'META-INF/LICENSE-FIREBASE.txt'
  31. exclude 'META-INF/NOTICE'
  32. }
  33.  
  34. dexOptions {
  35. javaMaxHeapSize "4g"
  36. }
  37. }
  38.  
  39. dependencies {
  40. compile fileTree(include: ['*.jar'], dir: 'libs')
  41. compile files('libs/activation.jar')
  42. compile 'com.android.support:appcompat-v7:21.0.3'
  43. compile 'com.google.firebase:firebase-database:11.2.2'
  44. compile 'com.google.firebase:firebase-auth:11.2.2'
  45. compile 'com.google.firebase:firebase-storage:11.2.2'
  46. compile 'com.google.android.gms:play-services:11.2.2'
  47. compile 'com.firebase:firebase-client-android:2.3.1'
  48. compile 'com.android.support.constraint:constraint-layout:+'
  49. compile 'com.android.support:multidex:1.0.1'
  50. compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
  51. compile 'com.android.support:design:26.+'
  52. compile 'com.android.support:support-v4:26.+'
  53. compile 'com.github.bumptech.glide:glide:4.2.0'
  54. compile 'com.squareup.picasso:picasso:2.5.2'
  55. compile 'com.github.jd-alexander:library:1.1.0'
  56. compile 'com.google.maps.android:android-maps-utils:0.5'
  57. compile 'com.facebook.android:facebook-android-sdk:[4,5)'
  58. testCompile 'junit:junit:4.12'
  59. annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
  60. }
  61.  
  62. apply plugin: 'com.google.gms.google-services'
  63.  
  64. import android.content.Context;
  65. import android.content.DialogInterface;
  66. import android.content.Intent;
  67. import android.net.ConnectivityManager;
  68. import android.net.NetworkInfo;
  69. import android.os.Handler;
  70. import android.provider.Settings;
  71. import android.support.v7.app.AlertDialog;
  72. import android.support.v7.app.AppCompatActivity;
  73. import android.os.Bundle;
  74.  
  75. public class splash extends AppCompatActivity {
  76.  
  77. private static int SPLASH_TIME_OUT = 3000;
  78.  
  79. @Override
  80. protected void onCreate(Bundle savedInstanceState) {
  81. super.onCreate(savedInstanceState);
  82. setContentView(R.layout.activity_splash);
  83.  
  84. // Alert Box
  85.  
  86. AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
  87. builder1.setTitle("Internet not connected");
  88. builder1.setMessage("You need to connect WiFi/Mobile-Data run this app.");
  89. builder1.setCancelable(false);
  90.  
  91. builder1.setPositiveButton(
  92. "Go to Settings",
  93. new DialogInterface.OnClickListener() {
  94. public void onClick(DialogInterface dialog, int id) {
  95.  
  96. startActivity(new Intent(Settings.ACTION_SETTINGS));
  97. finish();
  98. }
  99. });
  100.  
  101. builder1.setNegativeButton(
  102. "Cancel",
  103. new DialogInterface.OnClickListener() {
  104. public void onClick(DialogInterface dialog, int id) {
  105. finish();
  106. }
  107. });
  108.  
  109. //////////////////////////////
  110.  
  111. //WifiManager wifi =(WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);
  112.  
  113. ConnectivityManager cm = (ConnectivityManager)
  114. getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
  115. NetworkInfo networkInfo = cm.getActiveNetworkInfo();
  116.  
  117. if (networkInfo == null) {
  118.  
  119. AlertDialog alert11 = builder1.create();
  120. alert11.show();
  121. }
  122.  
  123. else {
  124. new Handler().postDelayed(new Runnable() {
  125. @Override
  126. public void run() {
  127. // This method will be executed once the timer is over
  128. // Start your app main activity
  129. Intent i = new Intent(splash.this, LoginActivity.class);
  130. startActivity(i);
  131. // close this activity
  132. finish();
  133. }
  134. }, SPLASH_TIME_OUT);
  135. }
  136. }
  137. }
Add Comment
Please, Sign In to add comment