我正在开发一个应用程序,需要通过流媒体播放音乐文件进行现场直播.
在请求歌曲api中,我可以指定带宽(例如:50kbps,100kbps,300,600或1Mbps).
bandwith越大,文件就越有时间获取.由于我不希望用户受到限制,因此我有多种选择来处理它:
检测手机是否正在使用3g,wifi或Edge,并为每个连接速度指定带宽.
让用户决定他将获得的歌曲的质量:像youtube(但用户不会是那些对计算有更多了解的人:软件越容易,它就越适合)
有办法正确评估连接速度:就像获取文件一样,测量它所花费的时间并设置带宽.
我知道如果用户松开wifi,或者在街上使用3g移动,连接速度可能会有很大变化.而事实是,当歌曲播放时我无法改变带宽.
也许你有关于你想分享的经验?
谢谢!
在Firebase中onMessageReceived(RemoteMessage remoteMessage),当您的应用位于Foreground时,系统会调用此方法.因此,点击通知后,您可以打开其他活动NotiicationActivity.
但是,如果您的应用程序处于后台,那么该方法将不会被调用,并且在单击通知时将仅打开Launcher活动.
那么NotificationActivity即使我们的应用程序处于后台,如何打开单击通知.
我的代码是这样的:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "MyFirebaseMsgService";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "From: " + remoteMessage.getFrom());
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
}
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
}
sendNotification(remoteMessage.getNotification().getBody());
}
private void sendNotification(String messageBody) {
Intent intent = new Intent(this, NewActivity.class);
intent.putExtra("key", messageBody);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = …Run Code Online (Sandbox Code Playgroud) 在Android Studio中启用Proguard后制作签名apk时出错.
警告:org.andengine.engine.camera.hud.controls.AnalogOnScreenControl:在库类android.util.FloatMath中找不到引用的方法'float cos(float)'警告:org.andengine.engine.camera.hud.controls .AnalogOnScreenControl:在库类android.util.FloatMath中找不到引用的方法'float sin(float)'警告:org.andengine.entity.modifier.PathModifier $ Path:找不到引用的方法'float sqrt(float) '在库类android.util.FloatMath中警告:org.andengine.entity.particle.ParticleSystem:在库类android.util.FloatMath中找不到引用的方法'float floor(float)'警告:org.andengine.entity. particle.emitter.CircleOutlineParticleEmitter:在库类android.util.FloatMath中找不到引用的方法'float cos(float)'警告:org.andengine.entity.particle.emitter.CircleOutlineParticleEmitter:找不到引用的方法'float sin (float)'在库类android.util.FloatMath中警告:org.andengine.entity.particle.emitter.CircleParticleEm itter:在库类android.util.FloatMath中找不到引用的方法'float cos(float)'警告:org.andengine.entity.particle.emitter.CircleParticleEmitter:找不到引用的方法'float sin(float)'在库类android.util.FloatMath中警告:org.andengine.opengl.font.StrokeFont:在库类android.util.FloatMath中找不到引用的方法'float floor(float)'警告:org.andengine.util.adt .transformation.Transformation:在库类android.util.FloatMath中找不到引用的方法'float sin(float)'警告:org.andengine.util.adt.transformation.Transformation:找不到引用的方法'float cos(浮点数''在库类android.util.FloatMath中警告:org.andengine.util.algorithm.path.astar.EuclideanHeuristic:在库类android.util.FloatMath中找不到引用的方法'float sqrt(float)'警告: org.andengine.util.math.MathUtils:在库类android.util.FloatMath中找不到引用的方法'float ceil(float)'警告:org.andengine.u til.math.MathUtils:在库类android.util.FloatMath中找不到引用的方法'float sin(float)'警告:org.andengine.util.math.MathUtils:找不到引用的方法'float cos(float) )'在库类android.util.FloatMath中警告:org.andengine.util.math.MathUtils:在库类android.util.FloatMath中找不到引用的方法'float sqrt(float)'警告:org.andengine.util .modifier.ease.EaseCircularIn:在库类android.util.FloatMath中找不到引用的方法'float sqrt(float)'警告:org.andengine.util.modifier.ease.EaseCircularOut:找不到引用的方法'float库类android.util.FloatMath中的sqrt(float)'警告:org.andengine.util.modifier.ease.EaseElasticIn:在库类android.util.FloatMath中找不到引用的方法'float sin(float)'警告: org.andengine.util.modifier.ease.EaseElasticOut:在库类android.util.FloatMath中找不到引用的方法'float sin(float)'警告:org.andengine.util.modifier.ease.EaseSi neIn:在库类android.util.FloatMath中找不到引用的方法'float cos(float)'警告:org.andengine.util.modifier.ease.EaseSineInOut:找不到引用的方法'float cos(float)'在库类android.util.FloatMath中警告:org.andengine.util.modifier.ease.EaseSineOut:在库类android.util.FloatMath`中找不到引用的方法'float sin(float)'
如果我们呼吁双方onClickListener和onClick()从XML的方法,则始终onClickListener方法被调用.
为什么会这样?
public class MainActivity extends Activity {
Button buttonCheck;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buttonCheck = (Button) findViewById(R.id.buttonTesting);
buttonCheck.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "On Click Listener", Toast.LENGTH_SHORT).show();
Log.e("OnClick", "Called");
}
});
}
public void checkStatus(View view) {
Toast.makeText(getApplicationContext(), "On checkStatus", Toast.LENGTH_SHORT).show();
Log.e("checkStatus", "Called");
}
}
Run Code Online (Sandbox Code Playgroud)
xml布局:
<Button
android:id="@+id/buttonTesting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="162dp"
android:onClick="checkStatus"
android:text="Check" />
Run Code Online (Sandbox Code Playgroud) android ×4
3g ×1
andengine ×1
android-wifi ×1
android-xml ×1
firebase ×1
networking ×1
onclick ×1
proguard ×1