小编bec*_*eck的帖子

Google doc没有预览错误

我使用谷歌文档在web broswer中显示pdf文件.之前工作正常.现在它没有提供预览.大多数情况下,它会使空白屏幕无法预览,但有时会打开pdf.但是我注意到,如果pdf的大小很小,它可以正常工作但如果大小稍大于10-100页或更多页面,则会显示无预览.

链接:

https://docs.google.com/gview?embedded=true&url=http://trafficpolice.gov.np/traffic/uploadfiles/56a0e8156d4ea.pdf
Run Code Online (Sandbox Code Playgroud)

码:

WebBrowser view = new WebBrowser();
view.setURL("https://docs.google.com/gview?embedded=true&url=http://trafficpolice.gov.np/traffic/uploadfiles/56a0e8156d4ea.pdf");
Run Code Online (Sandbox Code Playgroud)

google-docs google-docs-api codenameone google-document-viewer

14
推荐指数
2
解决办法
1万
查看次数

一直运行jobscheduler(打瞌睡或不打瞌睡)

如何在打盹或非打盹模式下运行jobscheduler,即我想一直运行bg作业.可能吗?

JobInfo jobInfo
      = new JobInfo.Builder(MYJOBID, jobService).setPeriodic(15 * 60 * 1000L)
        .setExtras(bundle)
        .setPersisted(true)
        .build();
Run Code Online (Sandbox Code Playgroud)

android android-jobscheduler

7
推荐指数
1
解决办法
1496
查看次数

如何通过http-get restful API访问Firestore数据库?

我在firebase中创建了一个云firebase类型数据库。请看下面的图片。但是如何从API(get)访问数据?如果我使用实时数据库,则只需' https:// [PROJECT_ID] .firebaseio.com / users / jack / name.json ',此网址即可提供json数据。但是,使用Cloud Firebase数据库,我无法获取json数据。我尝试使用“ https://firestore.googleapis.com/v1beta1/EmployeeApp/name=employeeapp-66646/newsFeed/ ”,但是它不起作用。

在此处输入图片说明

firebase google-cloud-firestore

6
推荐指数
2
解决办法
2534
查看次数

FusedLocationProviderClient 始终为 null,而 locationAvailability 通常为 false

我正在使用 jobScheduler 来获取后台位置更新。但每次调度作业时,FusedLocationProviderClient 都是 null。这是为什么?我已经检查了 if(FusedLocationProviderClient == null) 条件,并且每次安排作业时,其下的代码都会运行(这意味着 fusedLocationProviderClient 在初始化后为 null。)请查看下面的代码。此外,locationAvailability 通常为 false,因此不会调用 onLocationResult 来提供 null 位置值。如何优化 FusedLocationProviderClient。另一件事是 fusedLocationProviderClient 总是为 null 和 locationAvailability 给出 false 相关吗?

@Override
public boolean onStartJob(JobParameters jobParameters) {
    Log.e("onStartJob", "onStartJob");//for debug
    jobP = jobParameters;

    if (!checkAndRequestPermissions()) {
        Toast.makeText(this, "Please provide location permission for paramount app.", Toast.LENGTH_LONG).show();
        provider = null;
    } else {
        if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
                ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        }
        if (mLocationRequest == null) {
            Log.e("onStartJob", "LocationRequest initialized"); //for debug
            mLocationRequest …
Run Code Online (Sandbox Code Playgroud)

android android-jobscheduler fusedlocationproviderclient

5
推荐指数
1
解决办法
2130
查看次数

在作业计划程序中使用BroadcastReceiver来检测节能器

如何在jobScheduler中使用BroadcastReceiver?由于广播接收器的节电滤波器已发送到注册的接收器,因此在清单中声明接收器不起作用。此后,它应该在班级内部注册。我在jobScheduler中尝试过(请查看下面的代码),但是它不起作用。

public class MainActivity extends AppCompatActivity 
     @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (jobScheduler == null) {
            jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);

            ComponentName jobService =
                    new ComponentName(getPackageName(), MyJobService.class.getName());

            JobInfo jobInfo
                    = new JobInfo.Builder(MYJOBID, jobService).setPeriodic(15 * 60 * 1000L)
                    .setExtras(bundle)
                    .setPersisted(true)
                    .setRequiresDeviceIdle(false)
                    .build();

            int jobId = jobScheduler.schedule(jobInfo);

            if (jobScheduler.schedule(jobInfo) > 0) {
            } else {
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

MyJobService.java

public class MyJobService extends JobService {

    @Override
    public boolean onStartJob(JobParameters jobParameters) {
        jobP = jobParameters;

    if (mLocationRequest == null) {
        mLocationRequest …
Run Code Online (Sandbox Code Playgroud)

android broadcastreceiver android-jobscheduler

5
推荐指数
0
解决办法
605
查看次数

尝试将2个或多个模态组合为react-native-modal

我已经使用了react-native模态https://github.com/react-native-community/react-native-modal。我正在尝试使用多个模态从侧面结合下半模态和模态幻灯片。但是,当从第二模态返回到第一模态时,模态下降(关闭),然后另一个模态打开。请看下面的视频,看看我想做什么。

我想通过模态https://youtu.be/YaMjp_VJ_9Y获得的内容

使用react-native-modal https://youtu.be/GR8otXHhElc正在发生什么

export default class App extends Component<Props> {
  state = {
    visibleModal: null
  };

  renderButton = (text, onPress) => (
    <TouchableOpacity onPress={onPress}>
      <View style={styles.button}>
        <Text>{text}</Text>
      </View>
    </TouchableOpacity>
  );

  renderModalContent = () => (
    <View style={styles.modalContent}>
      <Text>Hello!</Text>
      {this.renderButton("Next Modal", () =>
        this.setState({ visibleModal: 6 })
      )}
      {this.renderButton("Close", () => this.setState({ visibleModal: null }))}
    </View>
  );

  renderNextModalContent = () => (
    <View style={styles.modalContent}>
      <Text>Hello from next modal!</Text>
      {this.renderButton("BACK", () => this.setState({ visibleModal: 5 …
Run Code Online (Sandbox Code Playgroud)

react-native

2
推荐指数
1
解决办法
2021
查看次数