Keyboard not showing in webview android - java

I'm going nuts with this issue I have, showing the keyboard on a webview.
I have done every single thing stackoverflow says, and still no success. Here's my code:
public void openChat(View v) {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Chat VM Latino");
WebView wv = new WebView(this);
wv.setFocusable(true);
wv.loadUrl("http://190.171.0.181:3001/");
wv.requestFocus(View.FOCUS_DOWN);
wv.getSettings().setJavaScriptEnabled(true);
wv.requestFocus(View.FOCUS_DOWN);
wv.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
alert.setView(wv);
alert.setNegativeButton("Cerrar",
new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
alert.show();
}
And here's my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.vmlatino"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.NoActionBar" >
<activity
android:name="com.racsa.UI.Splash"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.racsa.UI.EscogerStreamActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.racsa.UI.RadioActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.racsa.UI.RadioChatActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name="com.racsa.UI.VideoViewDemo"
android:configChanges="orientation|keyboard"
android:windowSoftInputMode="stateUnspecified"
android:label="Media/VideoView"
android:theme="#android:style/Theme.Holo.NoActionBar" >
</activity>
<activity
android:name="com.racsa.UI.VMChatActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name="io.vov.vitamio.activity.InitActivity"
android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
android:launchMode="singleTop"
android:theme="#android:style/Theme.NoTitleBar"
android:windowSoftInputMode="stateAlwaysHidden" />
</application>
</manifest>
I'm using the vitamio plugin for video streaming, any help will be appreciated!
Thanks in advance.

In the end, I didn't use a Dialog, I added a float like WebView, and the keyboard was now showing.

Related

Fix cannot find symbol mInterstitialAd = new InterstitialAd(this); symbol: variable mInterstitialAd location: class Ads [duplicate]

This question already has answers here:
What does a "Cannot find symbol" or "Cannot resolve symbol" error mean?
(18 answers)
Closed 1 year ago.
I'm integrating admob ads in my application with java but getting this
cannot find symbol mInterstitialAd = new InterstitialAd(this); symbol:
variable mInterstitialAd location: class Ads
. Please check the util/Ads.java & AndroidManifest.xml file and help me to fix it. I'm not able to fix this.
util/Ads.java
package com.indiapps.documentscanner.util;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import com.google.android.gms.ads.InterstitialAd;
public class Ads {
public static void showAds(Context context) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
long currentTimeMillis = System.currentTimeMillis();
long lastTime = sharedPreferences.getLong("lastTime", 0);
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
if (currentTimeMillis - lastTime > 60000) {
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putLong("lastTime", currentTimeMillis);
editor.apply();
Log.d("AAA","showAds");
}
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.indiapps.documentscanner">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:requestLegacyExternalStorage="true"
android:name="com.MainApplication"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="#string/admod_app_id"/>
<!-- HUNGDH -->
<activity
android:name="com.indiapps.documentscanner.camscanner.MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:noHistory="true" />
<activity
android:name="com.facebook.ads.AudienceNetworkActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:noHistory="true" />
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
<activity
android:name="com.indiapps.documentscanner.camscanner.MyPDFActivity"
android:label="#string/my_pdf"
android:theme="#style/AppTheme" />
<activity
android:name="com.indiapps.documentscanner.camscanner.FilterImageActivity"
android:label="#string/filter_image"
android:theme="#style/AppTheme" />
<activity
android:name="com.indiapps.documentscanner.camscanner.KnifeActivity"
android:theme="#style/AppTheme"
android:windowSoftInputMode="adjustResize|stateHidden" />
<activity
android:name="com.indiapps.documentscanner.camscanner.MySettingsActivity"
android:label="#string/action_settings"
android:theme="#style/AppTheme" />
<!-- DOCUMENT SCANNER -->
<activity
android:name="com.gpaddyv1.documentscanner.activities.SimpleDocumentScannerActivity"
android:label="#string/from_gallery"
android:theme="#style/AppTheme" />
<!-- IMAGE TO PDF -->
<activity
android:name="com.gun0912.tedpicker.ImagePickerActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme_picker" />
<!-- OPEN NOTE SCANNER -->
<activity
android:name=".OpenNoteScannerActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/title_activity_open_note_scanner"
android:screenOrientation="portrait"
android:theme="#style/FullscreenTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<action android:name="android.media.action.IMAGE_CAPTURE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".GalleryGridActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/my_gallery"
android:screenOrientation="portrait"
android:theme="#style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".FullScreenViewActivity"
android:theme="#style/FullscreenTheme" />
<activity
android:name=".SettingsActivity"
android:label="#string/settings"
android:theme="#style/AppTheme" />
<!-- PHOTO EDITOR -->
<activity android:name="com.gpaddyv1.documentscanner.process.view.ProcessImageActivity" />
<activity android:name="com.joshuabutton.queenscanner.sign.view.SignActivity" />
<activity android:name="com.joshuabutton.queenscanner.process.view.CombineBitMapActivity" />
<activity android:name="com.gpaddyv1.documentscanner.document.DocumentActivity" />
<activity android:name="com.joshuabutton.queenscanner.handle.HandleActivity" />
<activity android:name="com.indiapps.documentscanner.listdoc.DocsActivity" />
<activity
android:name=".AccountActivity"
android:theme="#style/AppTheme.NoActionBar1">
</activity>
</application>
</manifest>
You forgot to declare mIntersitialAd, you can do that right after the class opening braces.
public class Ads {
private InterstitialAd mInterstitialAd;
public static void showAds(Context context) {
//your code
}
}

Integrating Snap-kit in android

I am trying to add snap-kit in my application and I have integrated everything as their documentation. App successfully launched Snapchat app but it's not login it shows an error Something is wrong Here is my complete code and other implementation. This is the official documentation that I have followed https://kit.snapchat.com/docs/login-kit-android
MainActivity
public class MainActivity extends AppCompatActivity {
private ActivityMainBinding binding;
private static final String TAG = "MAIN_ACTIVITY";
String query = "{me{bitmoji{avatar},displayName}}";
String variables = null;
boolean isUserLoggedIn;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
isUserLoggedIn = SnapLogin.isUserLoggedIn(this);
if (isUserLoggedIn)
binding.btnLogin.setText("Logout");
else
binding.btnLogin.setText("Logout");
binding.btnLogin.setOnClickListener(v -> {
SnapLogin.getAuthTokenManager(this).startTokenGrant();
binding.progress.setVisibility(View.VISIBLE);
});
SnapLogin.getLoginStateController(this).addOnLoginStateChangedListener(mLoginStateChangedListener);
SnapLogin.fetchUserData(this, query, null, new FetchUserDataCallback() {
#Override
public void onSuccess(#Nullable UserDataResponse userDataResponse) {
if (userDataResponse == null || userDataResponse.getData() == null) {
return;
}
MeData meData = userDataResponse.getData().getMe();
if (meData == null) {
return;
}
binding.txtName.setText(userDataResponse.getData().getMe().getDisplayName());
if (meData.getBitmojiData() != null) {
Glide.with(MainActivity.this)
.load(meData.getBitmojiData().getAvatar())
.into(binding.imgProfile);
}
}
#Override
public void onFailure(boolean isNetworkError, int statusCode) {
}
});
}
final LoginStateController.OnLoginStateChangedListener mLoginStateChangedListener =
new LoginStateController.OnLoginStateChangedListener() {
#Override
public void onLoginSucceeded() {
// Here you could update UI to show login success
binding.progress.setVisibility(View.VISIBLE);
Log.d(TAG, "onLoginSucceeded: ");
binding.btnLogin.setText("Logout");
}
#Override
public void onLoginFailed() {
// Here you could update UI to show login failure
binding.progress.setVisibility(View.VISIBLE);
Log.d(TAG, "onLoginFailed: ");
}
#Override
public void onLogout() {
// Here you could update UI to reflect logged out state
binding.progress.setVisibility(View.VISIBLE);
Log.d(TAG, "onLogout: ");
}
};
}
Manifests
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iotait.snapchatandroid">
<uses-permission android:name="android.permission.INTERNET" />
<queries>
<package android:name="com.snapchat.android" />
</queries>
<application
android:name=".application.AppController"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.SnapchatAndroidDemo">
<meta-data
android:name="com.snapchat.kit.sdk.clientId"
android:value="**********************" />
<meta-data
android:name="com.snapchat.kit.sdk.redirectUrl"
android:value="*********************" />
<meta-data
android:name="com.snapchat.kit.sdk.scopes"
android:resource="#array/snap_connect_scopes" />
<activity android:name=".ui.sign.SigninActivity"
android:screenOrientation="nosensor"/>
<activity android:name=".ui.intro.IntroActivity"
android:screenOrientation="nosensor"/>
<activity android:name=".ui.login.LoginActivity"
android:screenOrientation="nosensor"/>
<activity
android:name=".ui.splash.SplashActivity"
android:screenOrientation="nosensor"
android:theme="#style/Theme.splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.MainActivity"
android:screenOrientation="nosensor" />
<activity
android:name="com.snapchat.kit.sdk.SnapKitActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="lmk"
android:path="/oauth2"
android:scheme="lmk" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>
Dependencies
implementation([
'com.snapchat.kit.sdk:login:1.1.4',
'com.snapchat.kit.sdk:core:1.1.4'
])
You need to add these line in the application tag
<meta-data android:name="com.snapchat.kit.sdk.clientId" android:value="1aab4ace-3f06-487d-bc85************"/>
<meta-data android:name="com.snapchat.kit.sdk.redirectUrl" android:value="https:********"/>
<meta-data android:name="com.snapchat.kit.sdk.scopes" android:resource="#array/snap_connect_scopes"/>
Use like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iotait.snapchatandroid">
<uses-permission android:name="android.permission.INTERNET" />
<queries>
<package android:name="com.snapchat.android" />
</queries>
<application
android:name=".application.AppController"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.SnapchatAndroidDemo">
<meta-data android:name="com.snapchat.kit.sdk.clientId" android:value="1aab4ace-3f06-487d-bc85************"/>
<meta-data android:name="com.snapchat.kit.sdk.redirectUrl" android:value="https:********"/>
<meta-data android:name="com.snapchat.kit.sdk.scopes" android:resource="#array/snap_connect_scopes"/>
<activity android:name=".intro.IntroActivity"/>
<activity android:name=".login.LoginActivity"/>
<activity
android:name=".splash.SplashActivity"
android:theme="#style/Theme.splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" />
<activity
android:name="com.snapchat.kit.sdk.SnapKitActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="lmk" android:host="lmk" android:path="/oauth2"/>
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>

Intent does not open in the following code

Could you please check this for me?
I put the part of the code which I see is needed, if any other part I forgot please tell me.
I am following a tutorial from thenewboston and I stuck in here, the Intent SQLView won't run, and I don't know what is the problem.
P.S. I wanted to use debugger to get inside of it, but it seems it does not recognize any SQLView class.
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thenewboston.travis"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".Test"
android:label="#string/app_name" >
</activity>
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".StartingPoint"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Menu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.MENU" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Prefs"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.PREFS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".AboutUs"
android:label="#string/app_name"
android:theme="#android:style/Theme.Dialog" >
<intent-filter>
<action android:name="com.thenewboston.travis.ABOUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".TextPlay"
android:label="#string/app_name" >
</activity>
<activity
android:name=".Email"
android:label="#string/app_name" >
</activity>
<activity
android:name=".Camera"
android:label="Camera Application"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".OpenedClass"
android:label="Opened Class"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Data"
android:label="Data"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".GFX"
android:label="Graphic"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".GFXSurface"
android:label="Graphic GFX"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".SoundStuff"
android:label="Sound Stuff"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Slider"
android:label="Slider"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Tabs"
android:label="Tabs"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".SimpleBrowser"
android:label="Simple Browser"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Flipper"
android:label="Simple Browser"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".SharedPrefs"
android:label="Shared Preferences"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".InternalData"
android:label="InternalData"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".ExternalData"
android:label="ExternalData"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".SQLiteExample"
android:label="SQLiteExample"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".SQLView"
android:label="SQLiteView"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
Part that invoke SQLView:
try {
Intent i = new Intent("com.thenewboston.travis.SQLVIEW");
startActivity(i);
} catch (Exception e) {
e.printStackTrace();
Dialog d = new Dialog(this);
d.setTitle("Heck Yeah!");
TextView tvi = new TextView(this);
tvi.setText("we're fucked");
d.setContentView(tvi);
d.show();
}
And the SQLView:
package com.thenewboston.travis;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class SQLView extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.sqlview);
TextView tv = (TextView) findViewById(R.id.tvSQLinfo);
HotOrNot info = new HotOrNot(this);
info.open();
String data = info.getData();
info.close();
tv.setText(data);
}
}
In your Manifest change this
<activity
android:name=".SQLView"
android:label="SQLiteView"
android:screenOrientation="portrait" >
</activity>
to this:
<activity
android:name=".SQLView"
android:label="SQLiteView"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="com.thenewboston.travis.SQLVIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
You should have an intenet filter in you manifest, you probably forgot that. See if it works.

GCM no receive messages in 2.3.6 but it's ok in 4.1.2

The problem is only with android 2.3.6 .
With 4.x, there isn't any problem, the receiver it's ok.
I have received the registration ID with 2.3.6 but the messages are never received.
My Manifest is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.arte.bilunaā€¯
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="net.arte.biluna.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="net.arte.biluna.permission.C2D_MESSAGE" />
<application
android:name="net.arte.biluna.businesslogic.CosmoApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock.Light" >
<!-- android:theme="#style/Theme.Sherlock" > -->
<activity
android:name="net.arte.biluna.SplashScreen"
android:label="#string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="net.arte.biluna.GreatestActivity"
android:screenOrientation="portrait" />
<activity
android:name="net.arte.biluna.LogInActivity"
android:screenOrientation="portrait" />
<activity
android:name="net.arte.biluna.HomePage"
android:screenOrientation="portrait" />
<activity
android:name="net.arte.biluna.LiveTourActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="net.arte.biluna.ChatActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="net.arte.biluna.ForYouActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="net.arte.biluna.StoreActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<service android:name="net.arte.biluna.GcmIntentService" />
<receiver
android:name="net.arte.biluna.GcmBroadcastReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="net.arte.biluna" />
</intent-filter>
</receiver>
</application>
My receiver:
public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
// Explicitly specify that GcmIntentService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
GcmIntentService.class.getName());
// Start the service, keeping the device awake while it is launching.
startWakefulService(context, (intent.setComponent(comp)));
setResultCode(Activity.RESULT_OK);
}
}
my activity:
...
if (checkPlayServices()) {
gcm = GoogleCloudMessaging.getInstance(this);
regid = getRegistrationId(context);
if (regid.equals("")) {
registerInBackground();
}
}
...
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
finish();
}
return false;
}
return true;
}
Check the Google play services version number and there is a pretty defined method to check Google play services a availability
Latest release of gcm using google play is very easy to implement and can be used for longer time.
See this tutorial. Hope it might help.
http://techlovejump.in/2013/11/android-push-notification-using-google-cloud-messaging-gcm-php-google-play-service-library/

Cannot get to launch the searchable activity

manifest code for the built in search, using the searchview.
can anyone tell me please what is wrong with it?
the SearchableActivity is created in the scr -> presentation, and it is using an xml layout called search.xml. I am new to android and can't find out what is wrong with my code. when launching the search view typing a word and press on "Go" on the keyboard the debugger opens a ActivityThread.perfor.... and tells me source not found.
here is my hole manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myTV.Android"
android:versionCode="4"
android:versionName="1.12" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="12" />
<uses-feature
android:name="com.google.android.tv"
android:required="true" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application
android:icon="#drawable/mytv"
android:label="#string/app_name"
android:theme="#style/Theme.Transparent" >
<activity android:name="myTV.Presentation.Main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="myTV.Presentation.Player" >
</activity>
<activity android:name="myTV.Presentation.VODCatalogGenre" >
</activity>
<activity android:name="myTV.Presentation.VODCatalog" >
</activity>
<activity android:name="myTV.Presentation.HomePage" >
</activity>
<activity android:name="myTV.Presentation.Programs" >
</activity>
<activity android:name="myTV.Presentation.Episodes" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
</activity>
<activity android:name="myTV.Presentation.ChannelsListing" >
</activity>
<activity android:name="myTV.Presentation.Packages" >
</activity>
<activity android:name="myTV.Presentation.SpecialOfferContent" >
</activity>
<activity android:name="myTV.Presentation.linkedpage" >
</activity>
<activity android:name="myTV.Presentation.howtolinkdevice" >
</activity>
<activity android:name="myTV.Presentation.OnlineRegister" >
</activity>
<activity android:name="myTV.Presentation.SpecialOffer" >
</activity>
<activity android:name="myTV.Presentation.MyVOD" >
</activity>
<activity android:name="myTV.Presentation.SearchEpisodes" >
</activity>
<activity android:name=".Countries" />
<activity android:name=".Genres" />
<activity android:name=".WeeklyRecap" />
<meta-data
android:name="android.app.default_searchable"
android:value=".SearchableActivity" />
<activity android:name=".SearchableActivity" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
</application>
import myTV.Android.R;
import android.app.Activity;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class SearchableActivity extends Activity{
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search);
// Get the intent, verify the action and get the query
Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
doMySearch(query);
}
}
public void doMySearch(String query){
//new Request().Search(query);
//new SearchEpisodes().Search(query);
Context context = getApplicationContext();
CharSequence text = query;
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
}
Here is my searchable.xml:
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/app_name"
android:hint="#string/SearchHint" >
</searchable>
Try adding the below in your <intent-filter>.
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
I think, your activity is not visible outside your Application.
Try android:exported="true".

Categories